<%@ page pageEncoding="UTF-8" contentType="text/html;charset=utf-8"%>
<%@ taglib uri="http://www.springframework.org/security/tags" prefix="security" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
<%@ taglib uri="http://www.joda.org/joda/time/tags"  prefix="joda" %>


<security:authorize ifAnyGranted="ROLE_SUPERVISOR,ROLE_33H46GZ4GDWDKQ50DWU5">
<div class="input-append input-prepend">
   <form id="dayform">
    <select name="year">
        <option value="2013">2013</option>
    </select>年             
    <select name="month">
      <c:forTokens items="1,2,3,4,5,6,7,8,9,10,11,12" delims="," var="m">
        <option value="${m}">${m}</option>
      </c:forTokens>
    </select>月   
    <button type="button" class='btn btn-primary' onclick='listResetDay()'>查看结存日期</button>
    <button class="btn btn-success" type="button" onclick="newOne();">
		<i class="icon-plus"></i>新增结存日期
    </button>
   </form>          
</div>

</security:authorize>
<table class="table table-bordered table-hover">
<thead>
<tr>
<th width="100">年</th>
<th width="100">月</th>
<th width="150">起始日期</th>
<th width="200">结存日期</th>
<th>管理</th>
</tr>
<tr>
<td colspan="5">

</td>
</tr>
</thead>
<tbody>
   <c:forEach items="${resetDays}" var="item">
     <tr>
       <td>
             <span class="label label-success">
                ${item.year}
             </span>           
                     
       </td>
       <td>
       <span class="label label-success">
         ${item.month}
       </span>
       </td>
       <td>
       
         <div class='input-append'>
           <input type="text" 
           class='datepicker input-small'
            value='<joda:format value="${item.firstDate}" pattern="yyyy-MM-dd"/>'
             id="firstday${item.year}${item.month}"
             readOnly
            />
         
         </div>  
       </td>
       <td>
       <div class='input-append'>
       <input type="text" 
              class='datepicker input-small'
            value='<joda:format value="${item.lastDate}" pattern="yyyy-MM-dd"/>'
             id="lastday${item.year}${item.month}"
             readonly
            />          
           <button class='btn btn-info' 
                   onclick="saveResetDay('${item.id}','firstday${item.year}${item.month}','lastday${item.year}${item.month}')">
           <i class="icon-ok-circle icon-white"></i> 
           </button>
       </div>
       </td>       
       
       <td>
        <a href="#" onclick="removeOne('${item.id}')">
          <i class="icon-remove"></i>
        </a>        
       </td>
     </tr>
   </c:forEach>
</tbody>
<tfoot>
  <tr>
    <td colspan="4">     
    </td>
  </tr>
</tfoot>
</table>

<script src="scripts/apps/reporter/daily/resetday/list.js" type="text/javascript"></script>